home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Pinceles y lápices / TriangleGradientBrush / TriangleGradientBrush.cs next >
Encoding:
Text File  |  2002-05-14  |  895 b   |  30 lines

  1. //----------------------------------------------------
  2. // TriangleGradientBrush.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class TriangleGradientBrush: PrintableForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new TriangleGradientBrush());
  14.      }
  15.      public TriangleGradientBrush()
  16.      {
  17.           Text = "Pincel degradado en trißngulo";
  18.      }
  19.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  20.      {
  21.           Point[] apt  = { new Point(cx,  0),
  22.                            new Point(cx, cy),
  23.                            new Point(0,  cy) };
  24.  
  25.           PathGradientBrush pgbrush = new PathGradientBrush(apt);
  26.  
  27.           grfx.FillRectangle(pgbrush, 0, 0, cx, cy);
  28.      }
  29. }
  30.